package tempo.timing;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class RaceInfo extends Activity
{
	private Button btnResetAll;
	private Button btnClear;
	private TextView txtRaceName;
	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.raceinfo);
		
		btnClear = (Button) findViewById(R.id.btnClear);
		btnClear.setOnClickListener(new OnClickListener()
		{
			public void onClick(View v)
			{
				Race.getCurrent().Clear();
			}
		});
		
		btnResetAll = (Button) findViewById(R.id.btnResetAll);
		btnResetAll.setOnClickListener(new View.OnClickListener()
		{
			public void onClick(View v)
			{
				Race.getCurrent().resetAll();
			}
		});
		
		txtRaceName = (TextView)findViewById(R.id.txtRaceName);
		txtRaceName.setText(Race.getCurrent().getName());
	}
	
	@Override
	public void onBackPressed()
	{
		Race.getCurrent().setName(txtRaceName.getText().toString());
		super.onBackPressed();
	}
}
